<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition>

        <p:dialog id="KpiCreateDlg" widgetVar="KpiCreateDialog" modal="true" resizable="false" appendTo="@(body)" header="#{bundle.CreateKpiTitle}">
            <h:form id="KpiCreateForm">
                <h:panelGroup id="display">
                    <p:panelGrid columns="2" rendered="#{kpiController.selected != null}">
                        <p:outputLabel value="#{bundle.CreateKpiLabel_idKpi}" for="idKpi" />
                        <p:inputText id="idKpi" value="#{kpiController.selected.idKpi}" title="#{bundle.CreateKpiTitle_idKpi}" required="true" requiredMessage="#{bundle.CreateKpiRequiredMessage_idKpi}"/>
                        <p:outputLabel value="#{bundle.CreateKpiLabel_descripcion}" for="descripcion" />
                        <p:inputText id="descripcion" value="#{kpiController.selected.descripcion}" title="#{bundle.CreateKpiTitle_descripcion}" />
                        <p:outputLabel value="#{bundle.CreateKpiLabel_kpi}" for="kpi" />
                        <p:inputText id="kpi" value="#{kpiController.selected.kpi}" title="#{bundle.CreateKpiTitle_kpi}" />
                        
                        <p:outputLabel value="#{bundle.CreateKpiLabel_idObjetivoEstrategico}" for="idObjetivoEstrategico" />
                        <p:selectOneMenu id="idObjetivoEstrategico" value="#{kpiController.selected.idObjetivoEstrategico}" required="true" requiredMessage="#{bundle.EditKpiRequiredMessage_idObjetivoEstrategico}">
                            <f:selectItems value="#{objetivoEstrategicoController.itemsAvailableSelectOne}"
                                           var="idObjetivoEstrategicoItem"
                                           itemValue="#{idObjetivoEstrategicoItem}"
                                           itemLabel="#{idObjetivoEstrategicoItem.descripcion}"/>
                            <f:converter binding="#{objetivoEstrategicoConverter}"/>
                        </p:selectOneMenu>
                    </p:panelGrid>
                    <p:commandButton actionListener="#{kpiController.create}" value="#{bundle.Save}" update="display,:KpiListForm:datalist" oncomplete="handleSubmit(args,'KpiCreateDialog');"/>
                    <p:commandButton value="#{bundle.Cancel}" onclick="KpiCreateDialog.hide()"/>
                </h:panelGroup>
            </h:form>
        </p:dialog>

    </ui:composition>
</html>
